import org.java_websocket.client.WebSocketClient
import org.java_websocket.handshake.ServerHandshake

print("hello world!")

URI uri = new URI("ws://192.168.3.37:8124");//自己写自己的IP接口

WebSocketClient mWs = new WebSocketClient(uri) {
    @Override
    void onOpen(ServerHandshake serverHandshake) {
        JsdApi.getInstance().print("连接成功!")
        JsdApi.getInstance().print(serverHandshake)
    }

    @Override
    void onMessage(String s) {
        JsdApi.getInstance().print("收到数据："+s)
    }

    @Override
    void onClose(int i, String s, boolean b) {
        JsdApi.getInstance().print(String.format("连接关闭：%d %s %b",i,s,b))
    }

    @Override
    void onError(Exception e) {
        JsdApi.getInstance().print("出错：%s".format(e.getMessage()))
    }
}

mWs.connect();


while (true){
    sleep(10000)
}